import { createRouter, createWebHistory } from "vue-router";

const layout = () => import("@/layout/index.vue");
//公共路由
export const constantRoutes = [
  {
    path: "/",
    redirect:"/login",
    children:[
      {
        path:'/login',
        name:'login',
        component:()=>import("@/views/login.vue")
      }
    ]
  },

  {
    path:'/complete',
    name:'complete',
    component:()=>import("@/views/complete.vue")
  },

  {
    path:'/invterPage',
    name:'invterPage',
    component:()=>import("@/views/invterPage.vue")
  },

   
  {
    path:'/fillInDetail',
    name:'fillInDetail',
    component:()=>import("@/views/fillInSubmit/detail.vue")
  },
  
  {
    path:'/fillInCreate',
    name:'fillInCreate',
    component:()=>import("@/views/fillInSubmit/create.vue")
  },

  {
    path:'/reviewDetail',
    name:'reviewDetail',
    component:()=>import("@/views/review/detail.vue")
  },
  
  {
    path: "/fill",
    name:"index",
    component:layout,
    children:[
      {
        path:'/fillList',
        name:'fillList',
        component:()=>import("@/views/fillInSubmit/list.vue")
      },
      {
        path:'/review',
        name:'review',
        component:()=>import("@/views/review/list.vue")
      }
    ]
  },
 
];

const router = createRouter({
  routes: constantRoutes,
  history: createWebHistory("/"), //history模式使用HTML5模式
});

// router.beforeResolve((to, from, next) => {
//   window.document.title = to.meta.title
//   next()
// })



// export const routerPath = (name,isParams = false) => {
//   if(!isParams){
//     router.push(name)
//   }else{
//     router.push({
//       name,
//       params: isParams
//     })
//   }
  
// }

export default router;
